
for i in range(1,8):
    if i < 5:
        print("{: ^7}".format('*' * (2*i-1)))
    else:
        print("{: ^7}".format('*' * ((7-i)*2+1)))

#课堂解法
n = 7
e = n // 2
for i in range(-e,e+1):
    print(' ' * abs(i),"*" * (n - 2 * abs(i)),sep="")
#课堂解法2
n=7
e = n//2
for i in range(-e, n-e):
    print("{:^{}}".format("*"*(n-2*abs(i)),n))